package com.wedu.view;

import com.wedu.entity.Student;
import com.wedu.service.StudentService;
import com.wedu.service.impl.StudentServiceImpl;
import org.junit.Test;

import java.util.Scanner;

/**
 * @author 乱码酱
 * @date ：2022-09-28 14:04
 * @program: javaUBD
 * @create:
 */
public class Register {
    private StudentService studentService = new StudentServiceImpl();
    private Scanner sc = new Scanner(System.in);
    Student student =new Student();
    //        注册测试
    @Test
    public void register(){
        //1.键盘录入，接收用户信息
        System.out.println("****欢迎注册****");
//        System.out.println("请输入id：");
//        int id = sc.nextInt();
        System.out.println("请输入用户名：");
        String name = sc.nextLine();
//        System.out.println("请输入性别：");
//        String sex = sc.nextLine();
//        System.out.println("请输入年龄：");
//        int age = sc.nextInt();
        System.out.println("请输入密码：");
        String password = sc.nextLine();
//        调用方法
        int reg = studentService.registerStu(name, password);
        //输出结果
        //3.判断结果，输出不同语句
        if (reg != 0) {
            //登录成功
            System.out.println("注册成功！");
        } else {
            System.out.println("用户名或密码注册错误！");
        }
    }
}
